package com.genesis.yunnanji.view;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.genesis.yunnanji.R;
import com.genesis.yunnanji.adapter.GeneralizeAdapter;
import com.genesis.yunnanji.bean.GeneralizeBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 创建日期：2018/9/26 on 11:34
 * 作者:Kite
 * 描述:优惠卷
 */
public class GeneralizeActivity extends BaseActivity {

    @BindView(R.id.rv_coupons)
    RecyclerView rvCoupons;

    private GeneralizeAdapter mGeneralizeAdapter;

    private List<GeneralizeBean> mGeneralizeList = new ArrayList<>();

    @Override
    public int getLayoutId() {
        return R.layout.activity_generalize;
    }

    @Override
    public void initView() {
        super.initView();
        setTitle("优惠劵");
        getData();
    }

    @OnClick(R.id.tv_receive)
    public void onViewClicked() {
        advance(ReceiveGeneralizeActivity.class);
    }

    private void getData() {
        mGeneralizeAdapter = new GeneralizeAdapter(rvCoupons, mGeneralizeList);
        mGeneralizeList.add(new GeneralizeBean("567", "限海鲜类使用", "满500可用", "2018.9.28-2019.9.28",4));
        mGeneralizeList.add(new GeneralizeBean("100", "限野生菌品类使用", "满200可用", "2018.9.28-2019.9.28", 0));
        mGeneralizeList.add(new GeneralizeBean("150", "限酒水类使用", "满500可用", "2018.9.28-2019.9.28", 1));
        mGeneralizeList.add(new GeneralizeBean("980", "限非人类使用", "满200可用", "2018.9.28-2019.9.28", 2));
        mGeneralizeList.add(new GeneralizeBean("999", "限动物类使用", "满500可用", "2018.9.28-2019.9.28", 3));
        mGeneralizeAdapter.getRecyclerView().setLayoutManager(new LinearLayoutManager(this));
        rvCoupons.setAdapter(mGeneralizeAdapter);
    }

}
